import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 获取列表 */
export const getTag = (params?: object) => {
  return requestClient.get<Result>(baseUrlApi('/portal/admin/tag'), {
    params,
  });
};

/** 添加 */
export const postTag = (data?: object) => {
  return requestClient.post<Result>(baseUrlApi('/portal/admin/tag'), data);
};

/** 获取信息 */
export const getTagInfo = (data: { id: number }) => {
  return requestClient.get<Result>(baseUrlApi(`/portal/admin/tag/${data.id}`));
};

/** 编辑 */
export const putTag = (data?: any) => {
  return requestClient.put<Result>(
    baseUrlApi(`/portal/admin/tag/${data.id}`),
    data,
  );
};

/** 删除 */
export const deleteTag = (data?: any) => {
  return requestClient.post<Result>(
    baseUrlApi(`/portal/admin/tag/delete`),
    data,
  );
};

/** 设置显示状态 */
export const postTagStatus = (data?: { id: object; status: string }) => {
  return requestClient.post<Result>(
    baseUrlApi(`/portal/admin/tag/status`),
    data,
  );
};

/** 获取列表 */
export const getTagSelectData = () => {
  return requestClient.get<Result>(baseUrlApi('/portal/admin/tag/select/data'));
};
